<?php

/**
 * 可用项目初始化
 */
class InitBehavior extends Behavior {

    //行为参数定义
    protected $options = array();

    public function run(&$params) {
        /**
         * 初始化网站基本配置
         */
        if (!file_exists(RUNTIME_PATH . "define.php")) {
            $Config = F("Config");
            if (!$Config) {
                $Config = D("Config")->config_cache();
            }
        }
        include RUNTIME_PATH . "define.php";
        //网站访问地址
        define("SITEURL", CONFIG_SITEURL);

        /* @todo 加载所有可用的模块 */
        /*
          $dir = scandir(APP_PATH . "Modules");
          dump(APP_PATH . "Modules");
          dump($dir);
          unset($dir[0], $dir[1]);
          $remove_dir = array(
          "index.html"
          );
          foreach ($remove_dir as $value) {
          $key = array_search($value, $dir);
          if ($key !== false) {
          unset($dir[$key]);
          }
          }
         * 
         */
        C('DEFAULT_GROUP', "Home");
        C('APP_GROUP_LIST', "Home,User");
    }

}

?>
